package com.lv.service.model

import com.lv.common.network.model.DataResult
import com.lv.common.network.support.serverData
import com.lv.service.net.ClientHFRReqBody
import com.lv.service.net.CompanyReqBody
import com.lv.service.net.LoginByCodeReqBody
import com.lv.service.net.LoginByPassWordReqBody
import com.lv.service.net.SendCodeBody
import com.lv.service.net.ServiceService
import com.lv.service.net.UserDeleteReqBody
import com.lv.service.net.VerifyCodeBody
import com.lv.service.network.BaseYgxRsp
import okhttp3.MultipartBody
import okhttp3.RequestBody

/**
 * 创建者：ygx
 * 创建日期：2021/9/17 11:28 PM
 * 描述：TODO
 */
class ServiceRepo(private val service: ServiceService) : IServiceResource {
    override suspend fun login(body: LoginByPassWordReqBody): DataResult<BaseYgxRsp> {
        return service.login(body).serverData()
    }

    override suspend fun loginByCode(body: LoginByCodeReqBody): DataResult<BaseYgxRsp> {
        return service.loginByCode(body).serverData()
    }

    override suspend fun latestUser(
    ): DataResult<BaseYgxRsp> {
        return service.latestUser().serverData()
    }

    override suspend fun findPros(
        map: Map<String, String>
    ): DataResult<BaseYgxRsp> {
        return service.findPros(map).serverData()
    }

    /**
     * 发送短信验证
     */
    override suspend fun sendCode(
        body: SendCodeBody
    ): DataResult<BaseYgxRsp> {
        return service.sendCode(body).serverData()
    }

    /**
     * 验证验证码
     */
    override suspend fun verifyCode(
        body: VerifyCodeBody
    ): DataResult<BaseYgxRsp> {
        return service.verifyCode(body).serverData()
    }

    /**
     * 意见反馈
     */
    override suspend fun feedback(text: String): DataResult<BaseYgxRsp> {
        return service.feedback(text).serverData()
    }

    /**
     * 修改个人信息
     */
    override suspend fun updateMyLogo(
        map: Map<String, RequestBody>, part: List<MultipartBody.Part>
    ): DataResult<BaseYgxRsp> {
        return service.updateMyLogo(map, part).serverData()
    }

    /**
     * 修改个人信息
     */
    override suspend fun updateMyMessage(body: Map<String, RequestBody>): DataResult<BaseYgxRsp> {
        return service.updateMyMessage(body).serverData()
    }

    /**
     * 注销个人信息
     */
    override suspend fun deleteUser(body: UserDeleteReqBody): DataResult<BaseYgxRsp> {
        return service.deleteUser(body).serverData()
    }

    /**
     * 发送短信验证-修改公司
     */
    override suspend fun sendCodeCom(body: SendCodeBody): DataResult<BaseYgxRsp> {
        return service.sendCodeCom(body).serverData()
    }

    /**
     * 验证验证码-修改公司
     */
    override suspend fun verifyCodeCom(body: VerifyCodeBody): DataResult<BaseYgxRsp> {
        return service.verifyCodeCom(body).serverData()
    }

    /**
     * 修改个人信息-业务员修改公司
     */
    override suspend fun updatePasswordOrPhone(body: CompanyReqBody): DataResult<BaseYgxRsp> {
        return service.updatePasswordOrPhone(body).serverData()
    }


    /**
     * 查找个数
     */
    override suspend fun findCount(
        map: Map<String, String>
    ): DataResult<BaseYgxRsp> {
        return service.findCount(map).serverData()
    }


    /**
     * 查找单个期数
     */
    override suspend fun findOnePdAndCa(map: Map<String, String>): DataResult<BaseYgxRsp> {
        return service.findOnePdAndCa(map).serverData()
    }

    /**
     *  查看小程序或进件信息
     */
    override suspend fun findOneSubmit(map: Map<String, String>): DataResult<BaseYgxRsp> {
        return service.findOneSubmit(map).serverData()
    }

    /**
     *  亨富然基础信息
     */
    override suspend fun findhengPros(map: Map<String, String>): DataResult<BaseYgxRsp> {
        return service.findhengPros(map).serverData()
    }

    /**
     * 亨富然开户
     */
    override suspend fun saveHengCompany(body: ClientHFRReqBody): DataResult<BaseYgxRsp> {
        return service.saveHengCompany(body).serverData()
    }
}